package com.yinhe.music.yhmusic.songmenu;


import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.yinhe.music.yhmusic.R;
import com.yinhe.music.yhmusic.adapter.SongMenuClassifyAdapter;
import com.yinhe.music.yhmusic.base.BasePresenter;
import com.yinhe.music.yhmusic.base.BaseServiceActivity;
import com.yinhe.music.yhmusic.widget.WrapContentGridLayoutManager;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/*
* 歌单分类
* */
public class SongMenuClassifyActivity extends BaseServiceActivity implements BaseQuickAdapter.OnItemClickListener {
    @BindView(R.id.recycler_view)
    RecyclerView mRecyclerView;

    SongMenuClassifyAdapter songMenuClassifyAdapter;

    @Override
    public int getLayoutResId() {
        return R.layout.activity_song_menu_classify;
    }

    @Override
    public BasePresenter getPresenter() {
        return null;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {
        setToolbar("分类");
        showQuickControl(true);

        List<SongMenuClassifySection> data = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            data.add(new SongMenuClassifySection(true,"语言" + i));
            for (int j = 0; j < 6; j++) {
                data.add(new SongMenuClassifySection("标签" + j));
            }
        }
        songMenuClassifyAdapter = new SongMenuClassifyAdapter(data);
        songMenuClassifyAdapter.setOnItemClickListener(this);
        mRecyclerView.setLayoutManager(new WrapContentGridLayoutManager(this, 3,
                GridLayoutManager.VERTICAL, false));
        mRecyclerView.setHasFixedSize(true);
        mRecyclerView.setAdapter(songMenuClassifyAdapter);
    }

    @Override
    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
        showToast(songMenuClassifyAdapter.getData().get(position).t);
    }
}
